Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockstore: extract ARC cache from Bloom cache #3026

Merged
merged 3 commits into from
Aug 3, 2016

Conversation

Kubuxu
Copy link
Member

@Kubuxu Kubuxu commented Aug 2, 2016

it removes race condition that would happen during various calls

If tests are ok, it is good for review.

License: MIT
Signed-off-by: Jakub Sztandera [email protected]

it removes race condition that would happen during various calls

License: MIT
Signed-off-by: Jakub Sztandera <[email protected]>
}
}
err := b.blockstore.PutMany(bs)
if err == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd reverse the logic here to be more conventional:

if err != nil {
  return err
}

for ....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, it was refactored out so there was more logic in here.

@Kubuxu Kubuxu force-pushed the feature/blockstore-separation branch from dd49a4e to a50495d Compare August 2, 2016 10:42
@whyrusleeping
Copy link
Member

@Kubuxu theres a lot of failing tests here...

}
cachedbs.Put(b)

cd.Lock()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats with locking here? you dont need to lock around a variable instantiation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah why is this lock here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The race detector was giving me an error otherwise for some reason, I can tinker with it more to find out the exact reason.

Maybe line 47 should be locked instead.

@whyrusleeping
Copy link
Member

what was the actual race condition here that youre fixing?

@Kubuxu
Copy link
Member Author

Kubuxu commented Aug 2, 2016

The race was happening when tests for ARC was running and the bloom cache finished initializing.

The test failures you see here are because the gateways were down.

License: MIT
Signed-off-by: Jakub Sztandera <[email protected]>
@Kubuxu Kubuxu force-pushed the feature/blockstore-separation branch from a50495d to 9543ed6 Compare August 2, 2016 14:03
h, ok := b.arc.Get(k)
if ok {
return h.(bool), ok
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop the else

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it is artefact from the refactor too

@whyrusleeping
Copy link
Member

Alright, LGTM. waiting on tests to pass now

@Kubuxu
Copy link
Member Author

Kubuxu commented Aug 3, 2016

All green.

@whyrusleeping whyrusleeping merged commit 8405b56 into master Aug 3, 2016
@whyrusleeping whyrusleeping deleted the feature/blockstore-separation branch August 3, 2016 12:17
@Kubuxu
Copy link
Member Author

Kubuxu commented Aug 3, 2016

Also the race in question: https://gist.github.com/Kubuxu/575f39058618a3fd5fd3efa518c65c1e

blockstore Blockstore
}

func arcCached(bs Blockstore, lruSize int) (*arccache, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • newArcCacheDS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants